BEGIN{
  abonds=1; objects=0; no=0;
  ns=ARGV[ARGC-1]; delete ARGV[ARGC-1]; ARGC--; #last arg is number of onames
  nso=ns;
  while(ns>0){
    oname[ARGV[ARGC-1]]=1;
    delete ARGV[ARGC-1]; ARGC--;
    ns--;
  }
#  print "FIG_PARSER  ",nso,ARGC,ARGV[1],ARGV[2] > "/dev/stderr";
}
/^</{
# pick object name
  a[n]=substr($0,2);match(a[n],/\".*\"/);
  if(RLENGTH>=0){namet=substr(a[n],RSTART+1,RLENGTH-2);objects=1;abonds=0};
# pick ps macro definition
  match(a[n],/\{.*\}/);
  if(RLENGTH>0){pst=substr(a[n],RSTART+1,RLENGTH-2)};
  match(a[n],/.*\{/);figt=substr(a[n],1,RLENGTH-1);
  if(!nso||(nso&&oname[namet])||abonds){
    if(!defined[namet]||abonds){
      no++;
      name[no]=namet;
      ps[no]=pst;
      fig[no]=figt;
      defined[namet]=no;
    }
  }
}
END{
  if(objects){print no, "[OBJECT PS DEFS]"}; 
  if(abonds){print no, "[ABONDS PS DEFS]"}; 
  for(i=1;i<=no;i++){
    if(name[i]){print name[i]};
    print fig[i];
    print ps[i]};
}
